function restrict(e, facetURI) {
    var inputElement = getTarget(e);
    var listTable = document.getElementById(facetURI + "-list");
    var text = inputElement.value;
    var regexp = new RegExp(text, "ig");
    
    var rows = listTable.getElementsByTagName("tr");
    for (var i = 0; i < rows.length; i++) {
    	var row = rows[i];
    	
    	if (text.length > 0) {
	    	var cell = row.cells.length > 1 ? row.cells[1] : row.cells[0];
	    	var restrictionValue = cell.firstChild.nodeValue;
	    	
    		if (restrictionValue.match(regexp)) {
    			if (row.style.display != "block") {
    				row.style.display = "block";
    			}
    		} else {
    			if (row.style.display != "none") {
    				row.style.display = "none";
    			}
    		}
    	} else {
    		row.style.display = "block";
    	}
    }
    listTable.style.display = "none";
    listTable.style.display = "block";
}

function selectBucketTheme(select, name) {
	var selectedIndex = select.selectedIndex;
	
	var bucketThemes = document.getElementsByName(name);
	for (var i = 0; i < bucketThemes.length; i++) {
		var bucketTheme = bucketThemes[i];
		if (i == selectedIndex) {
			bucketTheme.style.visibility = "visible";
		} else {
			bucketTheme.style.visibility = "hidden";
		}
	}
}